<template>
  <view>
    <view class="uni-section">
      <uni-section type="line" :title="'课程名称：' +PjList.title.subjectid+'.'+ PjList.title.subjectnm">
        <uni-section :title="'课程评价：' + queryObj.project" type="circle" :sub-title="'学期' + PjList.title.year_term">
          <template v-slot:right>
            <view>班级:{{PjList.title.class_name}}</view>
            <view>人数:{{PjList.title.aproject_number}}人</view>
          </template>
        </uni-section>
      </uni-section>
    </view>

    <view class="uni-margin-wrap">
      <swiper class="class-swiper" circular indicator-dots="true" autoplay="true" interval="3000" duration="1000">
        <swiper-item v-for="(item, index) in PjList.data1" :key="index">
          <uni-card padding="0" spacing="0" :is-shadow="true"
            shadow="0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);">
            <uni-list>
              <uni-list-item :title="'标题：'+item.aproitem_title" :note="'权重：'+item.aproitem_percent+'%'"
                :rightText="'期望分数：'+item.evaluate_standard+'分'"></uni-list-item>
              <uni-list-item :title="item.aproitem_memo"></uni-list-item>
            </uni-list>
          </uni-card>
        </swiper-item>
      </swiper>
      <view class="class-section">
        课程期望达成分数：{{PjList.title.aproject_sta}}分（满分100分）
      </view>
    </view>
    <view class="uni-section">
      <uni-section :title="'评价成绩'" type="circle"></uni-section>
    </view>

    <view class="stu-table-container">
      <zb-table :show-header="true" :columns="column" :stripe="true" :fit="true" :border="true" :data="data"
        :fixed="true">
      </zb-table>
    </view>
    <view class="uni-section">
      <uni-section type="circle" :title="PjList.title.subjectnm+'.'+PjList.title.class_name+''+'课程评价项目汇总'">
      </uni-section>
    </view>
    <view class="tb-container">
      <my-tb1 :myproject="queryObj.project"></my-tb1>
    </view>
  </view>
</template>

<script>
  export default {
    data() {
      return {
        queryObj: {
          project: '',
          subject: ''
        },
        PjList: [],
        column: [{
            name: 'student_name',
            label: '姓名',
            fixed: true,
            // width: 60,
            emptyString: '--'
          },
          {
            name: 'student_id',
            label: '学号'
          }
          // ,
          // {
          //   name: 'src1',
          //   label: 'LO1',
          //   // width: 50
          // },
          // {
          //   name: 'src2',
          //   label: 'LO2',
          //   // width: 50
          // },
          // {
          //   name: 'src3',
          //   label: 'LO3',
          //   // width: 50
          // },
          // {
          //   name: 'src4',
          //   label: 'LO4',
          //   // width: 50
          // },
          // {
          //   name: 'src5',
          //   label: 'LO5',
          //   // width: 50
          // },
          // {
          //   name: 'src6',
          //   label: 'LO6',
          //   // width: 50
          // },
          // {
          //   name: 'aproject_score',
          //   label: '总评',
          //   // width: 50
          // }
        ],
        data: [],
      }
    },

    onLoad(options) {
      // 将页面参数转存到 this.queryObj 对象中
      console.log(options)
      this.queryObj.project = options.project || ''
      this.queryObj.subject = options.subject || ''
      this.getPj1245Results()
      this.getPj1245ChartsResults()
    },
    methods: {
      async getPj1245Results() {
        const {
          data: res
        } = await uni.$http.get('?command=pj1245&project=' + this.queryObj.project + '&subject=' + this.queryObj
          .subject)
        // console.log(res)
        this.PjList = res.data
        // https://p270947p9.zicp.fun/mimsmobile/mimsmob.php?command=pj1245charts&project=1640654903
        this.data = res.data.data2
        // console.log(this.data)

        for (let i = 1; i < Object.keys(this.data[0]).length - 2; i++) {
          this.column.push({
            name: Object.keys(this.data[0])[i + 1],
            label: 'LO' + i,
          })
        }
        this.column.push({
          name: 'aproject_score',
          label: '总评',
        })
      },
      // 1245图表数据
      async getPj1245ChartsResults() {
        const {
          data: res
        } = await uni.$http.get('?command=pj1245charts&project=' + this.queryObj.project)

      }
    }
  }
</script>

<style lang="scss">
  .uni-margin-wrap {
    width: 690rpx;
    width: 100%;

    .class-swiper {
      height: 500rpx;
    }

    .swiper-item {
      display: block;
      height: 500rpx;
      line-height: 500rpx;
      text-align: center;
    }

    .class-section {
      // background-color: #F8F8F8;
      text-align: right;
      font-size: 12px;
      margin-bottom: 10px;
    }
  }

  .stu-table-container {
    height: 500rpx;
    // width: 100%;
    margin: 10px 10px;
  }

  .tb-container {
    // height: 500rpx;
    // // width: 100%;
    // margin: 30px 10px;
  }
</style>
